using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MeshCreatePanel : MonoBehaviour
{
    [SerializeField] private Button importBtn_Stl;
    [SerializeField] private Button importBtn_Species;
    [SerializeField] private Button importBtn_Vss;

    [SerializeField] private Dropdown switchModelDropdown;

    [SerializeField] private InputField xMinInputField;
    [SerializeField] private InputField xMaxInputField;
    [SerializeField] private InputField yMinInputField;
    [SerializeField] private InputField yMaxInputField;
    [SerializeField] private InputField zMinInputField;
    [SerializeField] private InputField zMaxInputField;
    
    [SerializeField] private InputField xGridNumInputField;
    [SerializeField] private InputField yGridNumInputField;
    [SerializeField] private InputField zGridNumInputField;
    // Start is called before the first frame update
    void Start()
    {
        switchModelDropdown.onValueChanged.AddListener(OnSwichModelDropDownValueChanged);
        print(" 111111 switchModelDropdown.itemText  "+switchModelDropdown.options[switchModelDropdown.value].text);
        importBtn_Stl.onClick.AddListener(OnImportBtn_StlClick);
        importBtn_Species.onClick.AddListener(OnImportBtn_SpeciesClick);
        importBtn_Vss.onClick.AddListener(OnImportBtn_VssClick);
        
        
    }
    private void OnImportBtn_StlClick()
    {
        print("importBtn.onClick.AddListener(OnImportBtnClick);");
        AirManager.instance.ImportFile("stl");
    }
    private void OnImportBtn_SpeciesClick()
    {
        print("importBtn.onClick.AddListener(OnImportBtnClick);");
        AirManager.instance.ImportFile("species");
    }
    private void OnImportBtn_VssClick()
    {
        print("importBtn.onClick.AddListener(OnImportBtnClick);");
        AirManager.instance.ImportFile("vss");
    }
    private void OnSwichModelDropDownValueChanged(int v)
    {
        print(v+"  switchModelDropdown.itemText  "+switchModelDropdown.options[v].text);
        GetXminDomainValue();
    }
    /// <summary>
    /// 获取当前模型值是二维还是三维
    /// </summary>
    /// <returns></returns>
    public string GetSwithcModelValue()
    {
        if (switchModelDropdown.value == 0)
            return "2";
        else
        {
            return "3";
        }
    }
    /// <summary>
    /// 获取X方向最小计算域
    /// </summary>
    /// <returns></returns>
    public string GetXminDomainValue()
    {
        if(string.IsNullOrEmpty(xMinInputField.text))
            print("当前为空");
        return xMinInputField.text;
    }
    /// <summary>
    /// 获取X方向最大计算域
    /// </summary>
    /// <returns></returns>
    public string GetXmaxDomainValue()
    {
        return xMaxInputField.text;
    }
    /// <summary>
    /// 获取Y方向最小计算域
    /// </summary>
    /// <returns></returns>
    public string GetYminDomainValue()
    {
        return yMinInputField.text;
    }
    /// <summary>
    /// 获取Y方向最大计算域
    /// </summary>
    /// <returns></returns>
    public string GetYmaxDomainValue()
    {
        return yMaxInputField.text;
    }
    /// <summary>
    /// 获取Z方向最小计算域
    /// </summary>
    /// <returns></returns>
    public string GetZminDomainValue()
    {
        return zMinInputField.text;
    }
    /// <summary>
    /// 获取Z方向最大计算域
    /// </summary>
    /// <returns></returns>
    public string GetZmaxDomainValue()
    {
        return zMaxInputField.text;
    }

    /// <summary>
    /// X方向网格数量
    /// </summary>
    /// <returns></returns>
    public string GetXCreateGridNumValue()
    {
        return xGridNumInputField.text;
    }
    /// <summary>
    /// Y方向网格数量
    /// </summary>
    /// <returns></returns>
    public string GetYCreateGridNumValue()
    {
        return yGridNumInputField.text;
    }
    /// <summary>
    /// Z方向网格数量
    /// </summary>
    /// <returns></returns>
    public string GetZCreateGridNumValue()
    {
        return zGridNumInputField.text;
    }
    
}
